/*
 * This file is part of GuitarMaster.
 * 
 * GuitarMaster is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * GuitarMaster is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with GuitarMaster.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.paris5.master2.guitarmaster.service;

/*
 * $Id: ServiceProductRemote.java 48 2013-04-09 21:33:54Z alice.khammy@gmail.com $
 * 
 * $HeadURL: http://com-paris5-master2-guitarmaster-distrib.googlecode.com/svn/trunk/com.paris5.master2.guitarmaster.distrib/src/com/paris5/master2/guitarmaster/service/ServiceProductRemote.java $
 * $Revision: 48 $
 * $Date: 2013-04-09 21:33:54 +0000 (Tue, 09 Apr 2013) $
 * $Author: alice.khammy@gmail.com $
 */
import com.paris5.master2.guitarmaster.bean.EcomBid;
import com.paris5.master2.guitarmaster.bean.EcomComment;
import com.paris5.master2.guitarmaster.bean.EcomProduct;
import com.paris5.master2.guitarmaster.bean.EcomProductType;
import com.paris5.master2.guitarmaster.bean.EcomScore;
import com.paris5.master2.guitarmaster.exception.EcomException;
import com.paris5.master2.guitarmaster.exception.EcomQueryException;
import com.paris5.master2.guitarmaster.exception.EcomValidationException;
import java.util.List;
import javax.ejb.Remote;

/**
 * //TODO : Add desciption
 *
 * @author Leticia Mahamed, Alice Khammy, mourad nedjahi, Saliou Mamadou Barry
 */
@Remote
public interface ServiceProductRemote {
        
    /**
     * get product by id
     * @param id String
     * @return EcomProduct
     * @throws EcomQueryException
     */
    public abstract EcomProduct getProduct(int id) throws EcomQueryException;
    
    /**
     * get ProductType by id
     * @param id String
     * @return EcomProduct
     * @throws EcomQueryException
     */
    public abstract EcomProductType getProductType(int id) throws EcomQueryException;
    
     /**
     * search for product by title and description
     * @param txt String exp
     * @param start int interval start
     * @param nb int count of elements wanted
     * @param order boolean asc/desc
     * @return List<EcomProduct>
     * @throws EcomTransactionException
     * @throws EcomValidationException 
     */
    public abstract List<EcomProduct> searchProducts(String txt, int offset, int limit, int field, boolean order) throws EcomValidationException, EcomQueryException;  
    /**
     * search for product by title and description. With equals
     * @param txt
     * @param offset
     * @param limit
     * @param field
     * @param order
     * @return
     * @throws EcomValidationException
     * @throws EcomQueryException 
     */
    public abstract List<EcomProduct> serchProductsEquals(String txt, int offset, int limit, int field, boolean order)throws EcomValidationException, EcomQueryException;
    /**
     * 
     * @param price
     * @return
     * @throws EcomValidationException
     * @throws EcomQueryException 
     */
    public abstract List<EcomProduct> getProductsPriceLessThan(float price, int offset, int limit)throws EcomValidationException, EcomQueryException;
    /**
     * 
     * @param lowerPrice
     * @param higherPrice
     * @param offset
     * @param limite
     * @return
     * @throws EcomValidationException
     * @throws EcomQueryException 
     */
    public abstract List<EcomProductType> getProductsPriceBewenn(float lowerPrice,int higherPrice, int offset, int limite )throws EcomValidationException, EcomQueryException;
    /**
     * count expected search result
     * @param txt String exp
     * @return int
     * @throws EcomValidationException
     * @throws EcomQueryException 
     */
    public abstract Integer countSearchedProducts(String txt) throws EcomValidationException, EcomQueryException;
    
    /**
     * get category products
     * @param txt String exp
     * @param start int interval start
     * @param nb int count of elements wanted
     * @param order boolean desc/asc
     * @return List<EcomProduct>
     * @throws EcomTransactionException
     * @throws EcomValidationException 
     */
    public abstract List<EcomProductType> getProductTypesByCategory(int categId, int offset, int limit, int field, boolean order) throws EcomValidationException, EcomQueryException;
    
    /**
     * get product bid list
     * @param id_product String
     * @return List<EcomBid>
     */
    public abstract List<EcomBid> getProductBids(int id_product, int offset, int limit) throws EcomQueryException;
    
    /**
     * bid on a product
     * @param id_user String
     * @param id_product String
     * @param price float
     * @EcomTransactionException
     */
    public abstract void bid(int id_user, int id_product, Float price) throws EcomQueryException, EcomException;
    
    /**
     * increase or decrease productType score depending on the second parameter
     * @param id_product_type
     * @param increase 
     * @throws EcomTransactionException
     */
    public abstract EcomScore setProductTypeScore(int id_product_type, boolean increase) throws EcomValidationException;
        
    /**
     * get product comments
     * @param id_product_type String
     * @param start int interval start
     * @param nb int count of elements wanted
     * @return List<EcomComment>
     * @throws EcomTransactionException 
     */
    public abstract List<EcomComment> getComments(int id_product_type, int offset, int limit) throws EcomQueryException;
    
    /**
     * 
     * @param id_product_type
     * @param comment
     * @throws EcomTransactionException 
     */
    public abstract void setComment(int user, int id_product_type, String comment);

    /**
     * 
     * @param categId
     * @param offset
     * @param limit
     * @param order
     * @return
     * @throws EcomValidationException
     * @throws EcomQueryException 
     */
    public List<EcomProduct> getProductByCategory(int categId, int offset, int limit,int order_by, boolean desc) throws EcomValidationException, EcomQueryException;

    /**
     * 
     * @param categId
     * @return
     * @throws EcomValidationException
     * @throws EcomQueryException 
     */
    public Integer countProductByCategory(int categId) throws EcomValidationException, EcomQueryException;

    /**
     * 
     * @param categId
     * @return
     * @throws EcomValidationException
     * @throws EcomQueryException 
     */
    public Integer countProductTypesByCategory(int categId) throws EcomValidationException, EcomQueryException;

    public List<EcomProduct> getAllProduct(int offset, int limit);

    public Integer countAllProduct();

    public List<EcomProductType> getAllProductType(int offset, int limit);

    public Integer countAllProductType();

    public List<EcomProduct> getAllProductsInBid(int offset, int limit, int order, boolean desc) throws EcomQueryException;

    public Integer countAllProductsInBid() throws EcomQueryException; 

    public EcomBid getLastProductPriceInBid(EcomProduct idProduct, int order, boolean desc) throws EcomQueryException;

    public int getAvailableQuantity(int idProductType);

    public void withdrawQuantity(Integer idProductType, Integer quantity);
    /**
     * 
     * @param idProductType
     * @param offset
     * @param limit
     * @return
     * @throws EcomQueryException 
     */
    public List<EcomProduct> getProductByProductType(int idProductType, int offset, int limit)throws EcomQueryException;

    
    public Integer countProductsPriceLessThan(float price) throws EcomValidationException, EcomQueryException;
    

}
